//
//  UIBarButtonItem+Extention.swift
//  SinaWb
//
//  Created by Jiang on 5/16/16.
//  Copyright © 2016 Jiang. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
   convenience init(ImageName : String , target : UIViewController , selector : Selector){
    
        self.init()
        let button =  UIButton(type: .Custom)
        button .setImage( UIImage(named: ImageName), forState: .Normal)
        button.setImage(UIImage(named: ImageName + "_highlighted"), forState: .Highlighted)
        button.addTarget(target, action: selector, forControlEvents: .TouchUpInside)
        button.sizeToFit()
        customView = button
    
    }

        
    
}
